<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{$is_language?'申請融資':'Apply for financing'}</title>
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <link rel="stylesheet" href="__MODULE_LIBS__/css/weui.min.css">
    <link rel="stylesheet" href="__MODULE_LIBS__/css/jquery-weui.css">
    <link rel="stylesheet" href="__MODULE_LIBS__/css/demos.css">
    <script src="__MODULE_LIBS__/js/jquery-2.1.4.js"></script>
    <script src="__MODULE_LIBS__/js/fastclick.js"></script>
    <script src="__MODULE_LIBS__/js/jquery-weui.js"></script>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        html {
            width: 100%;
            height: 100%;
            font-size: 20px;
            font-family: "Microsoft YaHei", "宋体", "Segoe UI", "Lucida Grande", Helvetica, Arial, sans-serif, FreeSans, Arimo;
            background: #F3F3F3;
        }

        body {
            margin: 0 auto;
            max-width: 750px;
            height: 100%;
            background: #F7F7F7;
        }

        /*顶部导航栏处的样式*/
        .navbar {
            position: relative;
            width: 100%;
            height: 2rem;
            font-size: 16px;
            color: #fff;
            line-height: 2rem;
            background: #373553;
        }

        .navbar-item {
            position: absolute;
            left: 0;
            top: 0;
            display: block;
            width: 3.2rem;
            height: 2rem;
            font-size: 14px;
            color: #fff;
            text-align: center;
        }

        .navbar-item > img {
            width: 0.8rem;
            height: 0.7rem;
            vertical-align: middle;
        }

        .navbar-center {
            text-align: center;
        }

        /*主体部分的样式*/
        .content {
            width: 100%;
        }

        .concenter {
            position: relative;
            padding: 0.5rem;
            margin-top: 1rem;
            background: #fff;
            overflow: hidden;
        }

        .title {
            font-size: 0.7rem;
        }

        #rmb {
            margin-top: 0.5rem;
            padding-left: 1.2rem;
            width: 100%;
            height: 1.8rem;
            font-size: 1.4rem;
            color: #555;
            border: 0;
            outline: none;
            border-bottom: 1px #ccc solid;
        }

        .fh {
            position: absolute;
            top: 1.9rem;
            left: 0.5rem;
            font-size: 1.5rem;
        }

        .conversion {
            margin-top: 0.2rem;
            font-size: 0.7rem;
            color: #f44444;
        }

        .remark {
            margin-top: 0.2rem;
            font-size: 0.7rem;
            color: #777;
            line-height: 1.4;
        }
        #capital_pro {
            font-size: 1rem;
        }
    </style>
</head>
<body>
<header class="navbar">
    <a href="{:url('goods/index')}" class="navbar-item">
        <img src="__MODULE_LIBS__/img/back.png"/>&nbsp;{$is_language?'返回':'Return'}
    </a>
    <div class="navbar-center">{$is_language?'申請融資':'Apply for financing'}</div>
    <div class="navbar-item1">
        <select name="" id="yy">
            <option value="1" {$is_language?
            'selected':''}>中文</option>
            <option value="0" {$is_language?
            '':'selected'}>English</option>
        </select>
    </div>
</header>
<div class="content">
    <form action="{:url('capital')}" method="post">
        <input type="hidden" name="data[id]" value="{$goods_id}">
        <div class="concenter">
            <div class="money">
                <p class="title">{$is_language?'選擇比例':'Choose the ratio'}</p>
                <select name="data[capital_pro]" id="capital_pro">
                    {foreach name="con_data" item="vo"}
                    <option value="{$vo}">1:{$vo}</option>
                    {/foreach}
                </select>
                <p class="conversion">{$is_language?'您可購買的資産金額':'The amount of assets you can buy'}：<span class="conver">{$user_data->money1}</span>,{$is_language?'融資':'financing'}：<span class="rongzi">0.00</span>,{$is_language?'本金':'principal'}：{$user_data->money1}。</p>

                <span class="title">{$is_language?'購買數量':'Purchase quantity'}:</span>
                <input type="number" name="data[sum]" id="rmb">
                <p class="conversion">{$is_language?'預計本金':'Estimated capital'}：<span class="yuji">0.00</span>,{$is_language?'预计融資':'Estimated financing'}：<span class="rongzi1">0.00</span>。</p>

                <!--<p class="conversion">{$is_language?'您可購買資産數量：':'The number of assets you can buy'}<span class="conver1">10</span>，价值<span class="jiazhi"></span>。</p>-->
            </div>
        </div>
        <div class="weui-btn-area">
            <input class="weui-btn weui-btn_warn" id="ackbtn" type="submit"
                   value="{$is_language?'確&nbsp;定':'Determine'}">
        </div>
    </form>
</div>
<input type="hidden" name="yuyan" value="<?php echo @$is_language?>" id="yuyan">

<script type="text/javascript">
    var aaa = $('#capital_pro').val()
    var ben = '{$user_data->money1}';
    var aaa = parseInt(aaa)+1;
    var sum = aaa*ben;
    var sum = sum.toFixed(2);
    var rongzi = sum-ben;
    var rongzi = rongzi.toFixed(2);
    $('.conver').html(sum);
    $('.rongzi').html(rongzi);
    $(document).on("change", 'select#yy', function () {
        var yy = $(this).val();
        console.log(yy)
        var url = "{:url('index/language')}";
        $.post(url, {language: yy}, function (res) {
            window.location.reload();
        })
    });

    $("#rmb").bind('input porpertychange',function(){
        var num = $(this).val();
        var danjia = '{$goods_data->money}';
        var bili = $('#capital_pro').val();
        var bili1 = parseInt(bili)+1;
        var sum = num*danjia;
        var mon = sum/bili1;
        var mon = mon.toFixed(2);
        var rongzi = mon*bili;
        var rongzi = rongzi.toFixed(2);
        $('.yuji').html(mon);
        $('.rongzi1').html(rongzi);
    });

    $(document).on("change", 'select#capital_pro', function () {
        var bili = $(this).val();
        var ben = '{$user_data->money1}';
        var bili = parseInt(bili)+1;
        var sum = bili*ben;
        sum = sum.toFixed(2);
        var rongzi = sum-ben;
        var rongzi = rongzi.toFixed(2);
        $('.conver').html(sum);
        $('.rongzi').html(rongzi);
    });



</script>
</body>
</html>
